def get_name(s):
	#print(s)
	s1=s.replace('.','_').split('_')
	for i in(0,len(s1)-1):
		s1[i]=s1[i].capitalize()
	if len(s1)<1:
		s2=s.capitalize()
	else:
		s2=''.join(s1)
	return s2

def get_cls_name(s):
	return 'CDex'+get_name(s)

def get_ret_type(s):
	if s.endswith('byte') or s.endswith('short') or s.endswith('int'):
		s1=s
	elif s=='long':
		s1='__int64'
	elif s=='ulong':
		s1='unsigned __int64'			
	elif s=='sleb128' or s=='uleb128p1':
		s1='int'
	elif s=='uleb128':
		s1='unsigned int'					
	else:
		s1=get_cls_name(s)+'*'
	
	return s1
	
def get_field_type(s):
	if s.endswith('byte') or s.endswith('short') or s.endswith('int'):
		s1=s
	elif s=='long':
		s1='__int64'
	elif s=='ulong':
		s1='unsigned __int64'			
					
	else:
		s1=get_cls_name(s)
	
	return s1
	
def get_result_type(s):
	if s.endswith('byte') or s.endswith('short') or s.endswith('int') or s.endswith('long') :
	  t=1
	elif s.endswith('leb128') or s.endswith('leb128p1'):
		t=2
	else:
		t=3

	
	return t	
	
def get_var_label(f):
	f1=f.split('_')
	f1[0]=f1[0].capitalize()
	if len(f1)>1:
		for i in range(1,len(f1))	:
			f1[i]=f1[i].lower()
	return ' '.join(f1)
	
def get_format(s):
	if s.endswith('byte'):
		s='%02x'
	elif  s.endswith('short'):
		s='%04x'
	elif  s.endswith('int'):	
		s='%08x'
	elif s.endswith('long'):
		s='%016x'
	else:
		s='%x'
		
	return s
	